const formatTime = date => {
  const year = date.getFullYear()
  const month = date.getMonth() + 1
  const day = date.getDate()
  const hour = date.getHours()
  const minute = date.getMinutes()
  const second = date.getSeconds()

  return `${[year, month, day].map(formatNumber).join('/')} ${[hour, minute, second].map(formatNumber).join(':')}`
}

const formatNumber = n => {
  n = n.toString()
  return n[1] ? n : `0${n}`
}



/* 
es6模块化
整体暴露
export {
   formatTime,
   a,
   b,
}

单个暴露
expost let a = 1;

默认暴露(一个值/函数)
export default 10;


*/

// commonJS 模块化语法
// 整体暴露 (同时暴露多个)
module.exports = {  
  formatTime,
  a:1,
  b:2,
}

// export default 10;
// 单个暴露 (每次暴露一个)
// module.exports.a = 1

// 默认值
// module.exports = 10;
